package faq.dao.impl;

import java.util.List;

import org.apache.ibatis.session.SqlSession;

import faq.dao.FaqsDao;
import faq.entity.Faqs;
import faq.entity.MyBatisUtil;

public class FaqsDaoImpl implements FaqsDao {

	SqlSession session =null;
	
	public List<Faqs> getFaqsByTitle(String title) {
		session=MyBatisUtil.openSession();
		FaqsDao faqsDao=session.getMapper(FaqsDao.class);
		return faqsDao.getFaqsByTitle(title);
	}

	public void addFaqs(Faqs faqs) {
		session=MyBatisUtil.openSession();
		FaqsDao faqsDao=session.getMapper(FaqsDao.class);
		faqsDao.addFaqs(faqs);
		session.commit();

	}

	public Faqs getFaqsById(int id) {
		session=MyBatisUtil.openSession();
		FaqsDao faqsDao=session.getMapper(FaqsDao.class);
		return faqsDao.getFaqsById(id);
	}

}
